﻿using Abp.Domain.Entities;
using DualControl.Common;
using DualControl.ControlMeasures;
using DualControl.EmergencyMeasures;
using DualControl.RiskPoints;
using System;
using System.Collections.Generic;
using System.Text;

namespace DualControl.HazardSources
{
    public class HazardSource : Entity, ISoftDelete, IMustHaveTenant
    {
        /// <summary>
        /// 危险源信息
        /// </summary>
        //危险源编号
        public string Code { get; set; }

        //风险点编号
        public int RiskPointId { get; set; }

        //作业步骤(场所/环节/部位)
        //public string JobStep { get; set; }
        public string HazardSourceName { get; set; }

        /// <summary>
        /// 一个作业步骤，对应一个风险因素(可以将多条写在一起)
        /// </summary>
        public string RiskFactor { get; set; }

        //岗位 可空
        public int? PostId { get; set; }
        /// <summary>
        /// 事故类型
        /// </summary>
       // public AccidentType? AccidentType { get; set; }

        /// <summary>
        /// 事故类型列表，用字符串表示，不同类型之间用","隔开
        /// </summary>
        public string AccidentTypes { get; set; }

        public List<AccidentType> AccidentTypesForView
        {

            get
            {
                string[] strarray;
                List<AccidentType> accidentlist = new List<AccidentType>();
                if (AccidentTypes!=null)
                {
                    strarray = AccidentTypes.Split(" ");
                    foreach (var a in strarray)
                    {
                        accidentlist.Add((AccidentType)Convert.ToInt16(a));
                    }
                }
                return accidentlist;
            }
        }


        /// <summary>
        ///风险评估信息
        /// </summary>
        public float? L { get; set; }
        public float? E { get; set; }
        public float? C { get; set; }

        /// <summary>
        /// 现在在前端进行D值的计算
        /// 可以放在这里实现
        /// </summary>
        //public float?D { get; set; }
     

        public RiskLevel? RiskLevel
        {
            get;set;          
        }

        public RiskColor? RiskColor
        {
            get; set;  

        }
        /// <summary>
        /// 风险管控信息
        /// </summary>
         //管控责任人
        public long? ResponsiblePerson { get; set; }

        /// <summary>
        /// 管控级别
        /// </summary>
        public int? ControlLevels { get; set; }

        /// <summary>
        /// 管控措施
        /// </summary>
        public ICollection<ControlMeasure> ControlMeasures { get; set; }

        /// <summary>
        /// 应急措施
        /// </summary>
        public ICollection<EmergencyMeasure> EmergencyMeasures { get; set; }

       // public RiskPoint RiskPoint { get; set; }
        public int TenantId { get; set; }
        public bool IsDeleted { get; set; }
    }

}
